Repository navigation
fix(runtime): a declarative update action answers its write's notice and droppedFields, and the console shows both - #38304
objectstack-fleet[bot] wants to merge 8 commits into
Conversation
…and droppedFields The data door answers the message a hook set for the person (notice) and the fields the engine did not store (droppedFields); the action executor now carries both onto its answer, at the REST and MCP doors alike, beside the warnings it already carried. Claude-Session: https://claude.ai/code/session_01L9qibwKycKW36n75AWgepd Co-authored-by: Claude <noreply@anthropic.com>
…lds get the record save's toast Claude-Session: https://claude.ai/code/session_01L9qibwKycKW36n75AWgepd Co-authored-by: Claude <noreply@anthropic.com>
…changeset Claude-Session: https://claude.ai/code/session_01L9qibwKycKW36n75AWgepd Co-authored-by: Claude <noreply@anthropic.com>
…ripped fields Claude-Session: https://claude.ai/code/session_01L9qibwKycKW36n75AWgepd Co-authored-by: Claude <noreply@anthropic.com>
… not the frozen memory driver Claude-Session: https://claude.ai/code/session_01L9qibwKycKW36n75AWgepd Co-authored-by: Claude <noreply@anthropic.com>
…casting them Claude-Session: https://claude.ai/code/session_01L9qibwKycKW36n75AWgepd Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 8 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 8 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 30 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 24b496d7e641070c8b79962dab166f23883c4adc && git checkout 24b496d7e641070c8b79962dab166f23883c4adc
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 600197a6aeaad9d819aa51fcfd590c75f886caf4 f53b48399622d2ca8f43278397b1382558208d04 && git checkout -B drift-repro 600197a6aeaad9d819aa51fcfd590c75f886caf4 && git merge --no-ff f53b48399622d2ca8f43278397b1382558208d04
node scripts/docs-audit/affected-docs.mjs --json 600197a6aeaad9d819aa51fcfd590c75f886caf4
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: Why TIER_DEFAULT: the review is owed by the ① Derived judgments
② Semver levelRight. ③ Boundary flags
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a: ACCEPT at
Nit N1 from the record (whitespace-only notice) needs no change. |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: A merge DELTA from ① Derived judgments
② Semver levelRight, and unchanged. ③ Boundary flags
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a merge delta: ACCEPT at
|
Requested by Tesla · project thread
Fixes #38103
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
What changes
packages/runtime/src/action-execution.ts:executeDeclarativeUpdateActionnow copies the data-plane update answer'snotice(the message a hook set withctx.notice) anddroppedFields(the engine's ownDroppedFieldsEvents for fields it did not store) onto its result, beside thewarningsit already copied.writeAnswerWarningsbecamewriteAnswerFeedback, one reader of the three members.DeclarativeUpdateResultgains optionalnoticeanddroppedFields, each present only when the write produced it, so a write with nothing to say answers byte-for-byte as before. Both action doors (RESTPOST /api/v1/actions/...and MCPrun_action) go through this executor, and the stale roll-up path (ERR_SUMMARY_RECOMPUTE) composes from the same answer.ui/packages/core/src/actions/ActionRunner.ts: for anoperation: 'update'action only, the runner reads the answer'snoticeand puts it first in the toast's description lines, ahead of any warnings. A notice alone keeps the toast asuccess; with warnings it is the onewarningtoast. This istoastRecordSave's rule for a record save. When the author turned the success toast off, the notice is still shown on its own, as aninfotoast in the hook's words. The runner does not readdroppedFieldsand adds no text of its own.ui/packages/app-shell/src/utils/flowLaunch.ts: the parse and announce steps ofannounceFlowDroppedFieldsare split into one parser and one announcer, and the flow path calls them unchanged. A newwithAnnouncedUpdateDroppedFields(handler, ctx)wraps a host's server-action handler. On a successfuloperation: 'update'dispatch whose answer names stripped fields, it raises the record save's own stripped-fields toast throughemitWriteWarning, labelled through the host's data source. That toast sits beside the action's toast and is never folded into it, the same second toast a record save and a flow button raise. It is raised whatever the action'stoastsettings say. It is not raised for a failed dispatch or for any action withoutoperation: 'update', and the handler'srefuseBeforeInputmember is kept.ui/packages/app-shell/src/hooks/useConsoleActionRuntime.tsx,ui/packages/app-shell/src/views/RecordDetailView.tsx: each host wraps its server-action handler withwithAnnouncedUpdateDroppedFields, reading its livet,fieldLabeland data source through the existing env ref. Its toast handler now takestype: 'info'(it used to fall through to success), and its success toast carries adescriptionwhen given one (only the warning variant did before).@objectstack/runtime,@object-ui/core,@object-ui/app-shellpatch.Not changed:
packages/spec(the action answer has no zod declaration; it is the runtime's TS interface), locale packs (no new text: the stripped-fields toast is the record save's existing one), HotCRM.Tests
packages/runtime/src/action-declarative-update.test.tsgets a new top-leveldescribein the shared harness. It runs on a realObjectQLwith the realSqlDriver(better-sqlite3:memory:) and the realObjectStackProtocolImplementationas theprotocolservice. The object has areadonly: truefield and abeforeUpdatehook that callsctx.notice. A control case shows the data door answeringnoticeanddroppedFieldsfor the action's write. The REST 200 answer and MCPrun_actioneach carry the same two members, equal to the data door's answer to the same write, and the stored row shows the strip. A write with no hook message and no stripped field carries neither key.ui/packages/core/src/actions/__tests__/ActionRunner.updateOperation.test.tsgets a newdescribethrough the realcreateServerActionHandler. It covers a notice alone (success toast, the notice as its line), a notice plus warnings (one warning toast, the notice first), Undo kept, the success toast turned off (an info toast in the hook's words), and adroppedFields-only answer (still a plain success here, because the host owns that toast). A reverse pin checks that a script action withoutoperationnever readsnotice.ui/packages/app-shell/src/utils/__tests__/flowLaunch.droppedFields-33009.test.tsgets a newdescribefor the wrapper. It checks the labelled stripped-fields toast and that the result is handed back unchanged, thatrefuseBeforeInputis kept, and two controls: no member, and a failed dispatch. A reverse pin covers an action withoutoperation: 'update'. The file's flow cases still pass unchanged.useConsoleActionRuntime.undoLookupId-11122.test.tsxandRecordDetailView.undoLookupId-11122.test.tsxeach get adescribethat goes down tosonner. On a grid row and on the record page, the success toast carries the notice and the Undo action, and the stripped field gets onetoast.warningtitled "Saved — but some fields did not take effect" that names the field. On the grid row, a control answer raises neither.Acceptance notes
origin/mainbd5407ecbefore any edit, with a real engine (the probe is in the card's pre-claim report). The data door answered["object","id","record","droppedFields","notice"]. The action's REST 200 body carried each of the two 0 times, and the storedreadonlyfield wasnull.Premise correctedon the card): the notice leads the action's own toast, and the stripped fields get the host's existingemitWriteWarningtoast. There are no new sentences in core.noticeonly. The stripped fields reach the host through a wrapper around its server-action handler, not throughToastHandleroptions. SoToastHandlergains no member, and the stripped-fields toast is raised even when the author turned the success toast off or a result dialog replaces it, as a record save's is.flowLaunch.droppedFields-33009.test.ts(the reader's shared harness) is a tenth file. The runtime pins went into the shared harnessaction-declarative-update.test.tsas a top-leveldescribe, per AGENTS.md's shared-harness rule, not into a new file.withheldMentions. This is a code-read inference only, with no producer found for a declarative update that writes a mention, so it is not filed.ToastHandler'stypegains nothing that is refused or narrowed: optional members only.Verification
pnpm --dir ui exec vitest run packages/core/src/actions/__tests__/ActionRunner.updateOperation.test.tsshows 25 passed, 6 of them the new block.writeAnswerFeedbackand the result block ofexecuteDeclarativeUpdateAction(action-execution.ts), thenwithAnnouncedUpdateDroppedFields(flowLaunch.ts), then the success-toast arm ofhandlePostExecution(ActionRunner.ts).Local readings at 3ac5fe2
action-declarative-update.test.ts41 passed (SqlDriver better-sqlite3:memory:);ActionRunner.updateOperation.test.ts25 passed;flowLaunch.droppedFields-33009.test.ts13 passed (the flow cases unchanged); the twoundoLookupId-11122host harnesses pass with their new blocks.pnpm --filter @objectstack/runtime test655 files, 12447 passed, 25 skipped (before the pins moved from the memory driver to SqlDriver; only that test file changed after, and it was re-run). ui vitest overpackages/core/src/actions, app-shell utils,useConsoleActionRuntime*,RecordDetailView*,FlowRunner*, providers: 303 files passed, 1 skipped; 3374 tests passed, 8 skipped.@objectstack/runtime(test layer 27 files / 183 errors held in the ledger, unchanged),@object-ui/core,@object-ui/app-shell.scripts/ablation-replace.mjs, each restore blob == HEAD: the runtime result's...feedbackspread deleted, 4 failed (2 A declarative update action drops validation warnings: Confirm Order over a framework quota shows only the success toast #37867 warnings pins, 2 new); the runner's notice read emptied, 6 failed; the wrapper's announce removed, 3 failed.showcase_task.progressmadereadonly: trueand its completion hook callingctx.notice, console built withconsole:build, booted--fresh --seed-admin.POST /api/v1/actions/showcase_task/...(Mark Done) answered keysdroppedFields, id, notice, object, operation, record,droppedFields[{object:'showcase_task', fields:['progress'], reason:'readonly'}], storedprogressunchanged. Clicking Mark Done on the record page in Chromium raised two toasts: success "SEO migration plan marked done." with the line "Completion recorded: the project lead was notified.", and warning "Saved — but some fields did not take effect" / "Read-only, so it did not take effect: Progress". The scratch edits were not committed.dispatch-gates --ranwith recorded exit codes at 3ac5fe2: 73 derived, 72 exit 0, 1 NOT MEASURED (exit 3:check-plugin-teardown-shape --self-test, fixture commit outside the shallow clone), 0 unrun. Roster gates under touched directories also exit 0:check:route-ledger-census,check:authz-resolver,check:error-code-casing,check:filter-alias-parity,check:changeset-fixed.overlap-check.mjsVERDICT clean exit 0 against main 73ec085, 0 PR heads.Generated by Claude Code
🤖 Generated with Claude Code